package com.truonghau.xmeasure.commons;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;

public class Utils {

    public static void showDummyWaitingDialog(final Context context, final Intent startingIntent) {
        // ...
        final ProgressDialog progressDialog = ProgressDialog.show(context, "Please wait...", "Loading data ...", true);

        new Thread() {
            public void run() {
                try{
                    // Do some work here
                    sleep(5000);
                } catch (Exception e) {
                }
                // start next intent
                new Thread() {
                    public void run() {
                    // Dismiss the Dialog 
                    progressDialog.dismiss();
                    // start selected activity
                    if ( startingIntent != null) context.startActivity(startingIntent);
                    }
                }.start();
            }
        }.start();  

    }

}    
